//
//  RegisterTextFiledView.m
//  League
//
//  Created by 博宇 李 on 2018/1/22.
//  Copyright © 2018年 ciyuanjuzhen. All rights reserved.
//

#import "RegisterTextFiledView.h"

@implementation RegisterTextFiledView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.frame = frame;
        self.backgroundColor = [UIColor blackColor];
        [self setupUI];
    }
    return self;
}
-(void)setupUI
{
    self.titleLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height/5)];
    self.titleLab.center = CGPointMake(self.width/2, self.titleLab.height/2);
    self.titleLab.backgroundColor = [UIColor whiteColor];
    self.titleLab.textAlignment = NSTextAlignmentCenter;
    self.titleLab.text = @"注册";
//    [self addSubview:self.titleLab];
    
    self.userNameView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.width/1.2, self.height/12)];
    self.userNameView.center = CGPointMake(self.width/2, self.titleLab.frame.origin.y+self.titleLab.height+self.userNameTf.height);
    self.userNameView.backgroundColor = [UIColor whiteColor];
    self.userNameView.layer.masksToBounds = YES;
    self.userNameView.layer.cornerRadius = 8;
    [self addSubview:self.userNameView];
    
    self.userNameTf = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, self.userNameView.width*0.75, self.userNameView.height)];
    self.userNameTf.center = CGPointMake(self.userNameView.width - self.userNameTf.width/2, self.userNameView.height/2);
    self.userNameTf.tag = 1000;
    self.userNameTf.backgroundColor = [UIColor clearColor];
    self.userNameTf.placeholder = @"请输入手机号";
    self.userNameTf.font = [UIFont fontWithName:kFontName size:self.userNameTf.height/3.5];
    [self.userNameView addSubview:self.userNameTf];
    
    
    self.countryNumberBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, self.userNameView.width - self.userNameTf.width, self.userNameView.height)];
    self.countryNumberBtn.backgroundColor = [UIColor clearColor];
    self.countryNumberBtn.titleLabel.font=[UIFont fontWithName:kFontName size:self.countryNumberBtn.height/3.5];
    [self.countryNumberBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.userNameView addSubview:self.countryNumberBtn];
    
    /*
    self.userNameTf = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, self.width/1.2, self.height/12)];
    self.userNameTf.tag = 1000;
    self.userNameTf.backgroundColor = [UIColor whiteColor];
    self.userNameTf.center = CGPointMake(self.width/2, self.titleLab.frame.origin.y+self.titleLab.height+self.userNameTf.height);
    self.userNameTf.placeholder = @"请输入手机号";
    self.userNameTf.font=[UIFont fontWithName:kFontName size:self.userNameTf.height/3.5];
    self.userNameTf.layer.masksToBounds = YES;
    self.userNameTf.layer.cornerRadius = 8;
    [self addSubview:self.userNameTf];
     */
    
   self.passWordTf = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, self.width/1.2, self.height/12)];
    self.passWordTf.center = CGPointMake(self.userNameView.x+self.userNameView.width/2, self.userNameView.frame.origin.y+self.userNameView.height+self.passWordTf.height);
    self.passWordTf.tag = 2000;
    self.passWordTf.backgroundColor = [UIColor whiteColor];
    self.passWordTf.placeholder = @"请输入密码";
    self.passWordTf.secureTextEntry = YES;
    self.passWordTf.font=[UIFont fontWithName:kFontName size:self.passWordTf.height/3.5];
    self.passWordTf.layer.masksToBounds = YES;
    self.passWordTf.layer.cornerRadius = 8;
    [self addSubview:self.passWordTf];
    
    self.userCodeTf = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, self.width/1.8, self.height/13)];
    self.userCodeTf.center = CGPointMake(self.userNameView.x+self.userCodeTf.width/2, self.passWordTf.frame.origin.y+self.passWordTf.height+self.userCodeTf.height);
    self.userCodeTf.placeholder = @"请输入验证码";
    self.userCodeTf.tag = 1001;
    self.userCodeTf.backgroundColor = [UIColor whiteColor];
    self.userCodeTf.layer.masksToBounds = YES;
    self.userCodeTf.layer.cornerRadius = 8;
    self.userCodeTf.font=[UIFont fontWithName:kFontName size:self.userCodeTf.height/3.5];
    [self addSubview:self.userCodeTf];
    
    UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 0)];
    leftView.backgroundColor = [UIColor whiteColor];
    self.passWordTf.leftView = leftView;
    self.passWordTf.leftViewMode = UITextFieldViewModeAlways;
    
    UIView *leftView_userCode = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, 0)];
    leftView_userCode.backgroundColor = [UIColor whiteColor];
    self.userCodeTf.leftView = leftView_userCode;
    self.userCodeTf.leftViewMode = UITextFieldViewModeAlways;
    
    self.getCodeBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.userNameView.x+self.userCodeTf.width+5, self.userCodeTf.y, self.userNameView.width - self.userCodeTf.width-5, self.userCodeTf.height)];
    self.getCodeBtn.backgroundColor = [UIColor clearColor];
    self.getCodeBtn.titleLabel.adjustsFontSizeToFitWidth = YES;
    [self.getCodeBtn setTitle:@"获取验证码" forState:UIControlStateNormal];
    [self.getCodeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.getCodeBtn.layer.masksToBounds = YES;
    self.getCodeBtn.layer.cornerRadius = 8;
    self.getCodeBtn.layer.borderWidth = 2;
    self.getCodeBtn.layer.borderColor = [[UIColor whiteColor] CGColor];
    self.getCodeBtn.titleLabel.font=[UIFont fontWithName:kFontName size:self.getCodeBtn.height/3.5];
    [self addSubview:self.getCodeBtn];
    
    
    self.registerBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, self.width/1.2, self.height/13)];
    self.registerBtn.center = CGPointMake(self.width/2, self.getCodeBtn.frame.origin.y+self.getCodeBtn.height+self.registerBtn.height);
    self.registerBtn.backgroundColor = [UIColor clearColor];
    [self.registerBtn setTitle:@"下一步" forState:UIControlStateNormal];
    [self.registerBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.registerBtn.layer.masksToBounds = YES;
    self.registerBtn.layer.cornerRadius = 8;
    self.registerBtn.layer.borderWidth = 2;
    self.registerBtn.layer.borderColor = [[UIColor whiteColor] CGColor];
    self.registerBtn.titleLabel.font=[UIFont fontWithName:kFontName size:self.registerBtn.height/3.5];
    [self addSubview:self.registerBtn];
    
    
    self.linkIn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, self.width/1.2, self.height/13)];
     self.linkIn.center = CGPointMake(self.width/2, self.registerBtn.frame.origin.y+self.registerBtn.height+self.linkIn.height);
    self.linkIn.backgroundColor = [UIColor clearColor];
    [self.linkIn setTitle:@"LinkdIn" forState:UIControlStateNormal];
    [self.linkIn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.linkIn.layer.masksToBounds = YES;
    self.linkIn.layer.cornerRadius = 8;
    self.linkIn.layer.borderWidth = 2;
    self.linkIn.layer.borderColor = [[UIColor whiteColor] CGColor];
    self.linkIn.titleLabel.font=[UIFont fontWithName:kFontName size:self.linkIn.height/3.5];
    [self addSubview:self.linkIn];
    
}
@end
